<%-- 
    Document   : standings.jsp
    Created on : 27.4.2011, 17:09:41
    Author     : Football-Statistics Team
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>

<f:setLocale value="${pageContext.request.locale}"/>
<f:setBundle basename="labelsBundle" />

<!DOCTYPE html>
<html>
    <head>
        <title><f:message key="project_title" /></title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <link rel="stylesheet" type="text/css" href="css/main.css" media="screen" />
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
        <script type="text/javascript" src="js/superfish.js"></script>
        <script type="text/javascript" src="js/hoverIntent.js"></script>
        <script type="text/javascript" src="js/misc.js"></script>
        <script type="text/javascript" src="js/jquery.tablesorter.min.js"></script>
        <script type="text/javascript" src="https://www.google.com/jsapi"></script>
        <c:if test="${not empty xml_standings}">
        <script type="text/javascript">
              google.load('visualization', '1', {'packages':['corechart']});
              google.setOnLoadCallback(drawChart);
              function drawChart() {
                var data = new google.visualization.DataTable();
                data.addColumn('string', '<f:message key="team"/>');
                data.addColumn('number', '<f:message key="points"/>');
                data.addRows([
                    <c:import url="XSLT/standings_chart.xsl" var="xslt"/>
                    <x:transform xml="${xml_standings}" xslt="${xslt}"/>
                ]);
                var chart = new google.visualization.PieChart(document.getElementById('chart_div'));
                chart.draw(data, {width: 600, height: 350, backgroundColor: '#f5f5f5', is3D: true, legend: 'left', pieSliceText: 'none', title: '<f:message key="points_distribution"/>'});
              }
        </script>
        </c:if>
    </head>
    <body>
        <div class="c">
            <header>
                <a id="logo" href="${pageContext.request.contextPath}/"></a>            
            </header>
            <nav>
                <c:if test="${not empty xml_menu}">
                    <jsp:include page="menu.jsp">
                        <jsp:param name="section" value="standings"/>
                    </jsp:include>
                </c:if>
            </nav>
            <section>
                <h1><f:message key="standings" /></h1>
                <jsp:include page="standingsNavigation.jsp"/>
                <c:if test="${not empty xml_standings}">
                    <c:import url="XSLT/standings.xsl" var="xslt"/>

                    <f:message key="team" var="team"/>
                    <f:message key="wins" var="wins"/>
                    <f:message key="draws" var="draws"/>
                    <f:message key="losses" var="losses"/>
                    <f:message key="score" var="score"/>
                    <f:message key="points" var="points"/>
                    <f:message key="matches" var="matches"/>

                    <x:transform xml="${xml_standings}" xslt="${xslt}">
                        <x:param name="url" value="${pageContext.request.contextPath}"/>
                        <x:param name="team" value="${team}"/>
                        <x:param name="wins" value="${wins}"/>
                        <x:param name="draws" value="${draws}"/>
                        <x:param name="losses" value="${losses}"/>
                        <x:param name="score" value="${score}"/>
                        <x:param name="points" value="${points}"/>
                        <x:param name="matches" value="${matches}"/>
                    </x:transform>
                </c:if>
                <div id="chart_div"></div>
            </section>
        </div>
    </body>
</html>
